﻿
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;

namespace Stanza.MSBuild.Tasks
{
    public class PublishVisualStudioProject : Task
    {
        [Required]
        public string SettingsFile { get; set; }

        [Output]
        public string ZipFileName { get; private set; }

        public override bool Execute()
        {
            Publish publish = new Publish( WriteLogMessage );
            publish.PublishSolution( SettingsFile );
            ZipFileName = publish.ZipFileName;
            return true;
        }

        void WriteLogMessage( string logMsg )
        {
            Log.LogMessageFromText( logMsg, MessageImportance.Normal );
        }
    }
}
